﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DAL;
namespace BLL
{
    /// <summary>
    ///Department 的摘要说明
    /// </summary>
    public class Department
    {
        public Department()
        {
            //
            //TODO: 在此处添加构造函数逻辑
            //
        }

        public static DAL.Account_Department GetDepartmentByID(string ID)
        {
            FireMisDataContext db = new FireMisDataContext();
            var pp = from aa in db.Account_Department where aa.DepartmentID == ID select aa;
            if (pp.Count() > 0)
            {
                return pp.First();
            }
            else
            {
                return null;
            }
        }

        public static Account_Department GetDepartmentByUserID(string p)
        {
            FireMisDataContext db = new FireMisDataContext();
            Account_Users user = db.Account_Users.Where(o => o.UserID == p).FirstOrDefault();
            if (user != null)
            {
                return user.Account_Department;
            }
            else
            {
                return null;
            }
        }
    }
}
